package com.example.tang.zhayan.utils;

import android.view.View;
import android.widget.TextView;

import com.example.tang.zhayan.BaseApp;
import com.example.tang.zhayan.bean.DbBuyDetail;

import org.xutils.ex.DbException;

import java.util.List;

/**
 * Created by tang on 2015/12/19.
 */
public class EventUtils {

    public static void setGoodsNum(TextView textNum) {
        try {
            List<DbBuyDetail> all = BaseApp.getApp().getDb().findAll(DbBuyDetail.class);
            if (all == null || all.size() == 0) {
                textNum.setVisibility(View.GONE);
            } else {
                textNum.setVisibility(View.VISIBLE);
                textNum.setText((all.size()) + "");
            }
        } catch (DbException e) {
            e.printStackTrace();
        }
    }
}
